package com.ymatou.iapi.m.couponservice.testcase;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.m.couponservice.parameter.CreateCouponBean;
import com.ymatou.iapi.m.couponservice.parameter.GetPlatformBatchesByPagingBean;
import com.ymatou.iapi.m.couponservice.parameter.batchinfo2;
import com.ymatou.iapi.m.couponservice.service.CreateCouponCall;
import com.ymatou.iapi.m.couponservice.service.GetPlatformBatchesByPagingCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponServiceCallService;
import com.ymttest.business.service.CouponServiceMCallService;
import com.ymttest.database.model.YmtCoupon;
import com.ymttest.database.model.YmtCouponBatch;
import com.ymttest.database.model.YmtCouponConversionCode;
import com.ymttest.database.sqlwapper.YmtCouponBatchWapper;
import com.ymttest.database.sqlwapper.YmtCouponConversionCodeWapper;
import com.ymttest.database.sqlwapper.YmtCouponWapper;
import com.ymttest.utils.TestDataManager;
/**
*分页获取平台优惠券批次列表信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetPlatformBatchesByPaging{
	private static GetPlatformBatchesByPagingBean getplatformbatchesbypagingBean;
	private static GetPlatformBatchesByPagingCall getplatformbatchesbypagingCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("分页获取平台优惠券批次列表信息");
	}

	@Before
	public void caseUp() {
		getplatformbatchesbypagingBean=new GetPlatformBatchesByPagingBean();
		getplatformbatchesbypagingCall=new GetPlatformBatchesByPagingCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getplatformbatchesbypagingCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_001() {
		Logger.start(true,"根据批次编号获取平台优惠券批次列表信息");
		try {
			Map result= new YmtCouponBatchWapper().getTop1PlatformLinkCouponInfo().get(0);
			
			getplatformbatchesbypagingBean.setBatchCode(result.get("sBatchCode").toString());
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
		
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回Message");

			verifyReturn();
			
			// JIRACONN-10605:获取平台优惠券列表多返回两个字段： 
			//1、couponTotal：批次优惠券总数 
			//2、receivedQuantity：已领取优惠券数量
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
		        
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(2,batchInfo.getCouponTotal(),"验证返回CouponTotal");
		             Logger.verifyEquals(1,batchInfo.getReceivedQuantity(),"验证返回CouponTotal");   
		        }

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_002() {
		Logger.start(true,"根据兑换码获取平台优惠券批次列表信息");
		try {
			
			YmtCouponConversionCode code = new YmtCouponConversionCodeWapper().getTop1().get(0);
			
			getplatformbatchesbypagingBean.setConversionCode(code.getConversioncode());
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回Message");

			verifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_003() {
		Logger.start(true,"根据优惠券码获取平台优惠券批次列表信息");
		try {
			CouponServiceMCallService couponServiceMCallService = new CouponServiceMCallService();
			CreateCouponBean createCouponBean = couponServiceMCallService.setDefaultPlatformCreateCouponBeanForRecieve();
			CreateCouponCall createCouponCall = couponServiceMCallService.createPlatformCoupon(createCouponBean);
			
			String batchCode = createCouponCall.getBatchCode();
			
			String couponcode = new CouponServiceCallService().receiveCouponInfo(batchCode, TestDataManager.getRandomIntNum(6));
			getplatformbatchesbypagingBean.setCouponCode(couponcode);
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回Message");

			verifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_004() {
		Logger.start(true,"根据优惠券类型-优惠码获取平台优惠券批次列表信息");
		try {

			getplatformbatchesbypagingBean.setSendType(1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
     
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,
			             		batchInfo.getSendType(),
			                     "验证返回SendType1");


		        }
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_005() {
		Logger.start(true,"根据优惠券类型-私有券获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(2);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
			verifyReturn();
				
		    for(int i=0;i<batchList.size();i++)
		    {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(2,
			             		batchInfo.getSendType(),
			                     "验证返回SendType2");
		    }		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_006() {
		Logger.start(true,"根据优惠券方式-领取获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
     
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,
			             		batchInfo.getAcquireCouponMethod(),
			                     "验证返回AcquireCouponMethod为1");


		        }		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_007() {
		Logger.start(true,"根据优惠券方式-兑换获取平台优惠券批次列表信息");
		try {
			
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(2);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			 Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
     
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(2,
			             		batchInfo.getAcquireCouponMethod(),
			                     "验证返回AcquireCouponMethod为2");


		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_008() {
		Logger.start(true,"根据商品限制类型-指定买手获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,batchInfo.getProductLimitType(),
			                     "验证返回ProductLimitType为1");

		        }	
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_009() {
		Logger.start(true,"根据商品限制类型-指定商品获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(2);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		        	 Logger.verifyEquals(2,batchInfo.getProductLimitType(),
		                     "验证返回ProductLimitType为2");
		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_010() {
		Logger.start(true,"根据商品限制类型-指定活动获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(3);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyNotNull(batchInfo.getApplyActivityIds(),
			                     "验证返回ApplyActivityIds非空");

		        }				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_011() {
		Logger.start(true,"根据商品限制类型-指定分类获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(4);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyNotNull(batchInfo.getApplyProductCategories(),
			                     "验证返回ApplyProductCategories非空");

		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_012() {
		Logger.start(true,"根据商品限制类型-指定国家获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(5);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyNotNull(batchInfo.getApplyCountrys(),
			                     "验证返回ApplyCountrys非空");

		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_013() {
		Logger.start(true,"根据有效期类型-绝对有效期获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(0);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(0,batchInfo.getEffectiveType(),
			                     "验证返回EffectiveType");

		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_014() {
		Logger.start(true,"根据有效期类型-相对有效期获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,batchInfo.getEffectiveType(),
			                     "验证返回EffectiveType");

		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_015() {
		Logger.start(true,"根据申请部门获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(4);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
	
		             Logger.verifyEquals(4,batchInfo.getApplyDepartment(),
			                     "验证返回ApplyDepartment");

		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_016() {
		Logger.start(true,"根据创建时间获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			
			 Date dNow = new Date(); // 当前时间
		        Date dBefore = new Date();
		        Date dAfter = new Date();

		        Calendar calendar1 = Calendar.getInstance(); // 得到日历
		        calendar1.setTime(dNow);// 把当前时间赋给日历
		        calendar1.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
		        dBefore = calendar1.getTime(); // 得到前一天的时间

		        Calendar calendar2 = Calendar.getInstance(); // 得到日历
		        calendar2.setTime(dNow);// 把当前时间赋给日历
		        calendar2.add(Calendar.DAY_OF_MONTH, 10); // 设置为后十天
		        dAfter = calendar2.getTime(); // 得到前一天的时间
		        
			getplatformbatchesbypagingBean.setCreateTimeStart(dBefore);
			getplatformbatchesbypagingBean.setCreateTimeEnd(dAfter);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		        	 Map item = new YmtCouponBatchWapper().selectBatchInfoBysBatchCode(batchCode).get(0);
		        	
		        	 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		        	 Date time = formatter.parse(item.get("dAddTime").toString());
		         	
		        	Logger.verifyEquals(true, time.after(dBefore), "验证批次创建时间");
		        	Logger.verifyEquals(true, time.before(dAfter), "验证批次创建时间");
				        
		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	private void verifyReturn()
	{
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
	        
	        for(int i=0;i<batchList.size();i++)
	        {
	        	 String batchCode = batchList.get(i).getBatchCode();
	        	 batchinfo2 batchInfo = batchList.get(i);
	        	 
	        	 Map item = new YmtCouponBatchWapper().selectBatchInfoBysBatchCode(batchCode).get(0);

	             Logger.verifyEquals(Integer.parseInt(item.get("iBatchId").toString()),
	             		batchInfo.getBatchId(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponBatch中sBatchCode=" + batchCode
	                             + "记录中iBatchId字段相同");
	             
	             Logger.verifyEquals(item.get("sBatchCode").toString(),
	             		batchInfo.getBatchCode(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponBatch中sBatchCode=" + batchCode
	                             + "记录中sBatchCode字段相同");

	          
	             if(item.get("iEffectiveType")==null)
	             {
	             	Logger.verifyEquals(0,
	             		batchInfo.getEffectiveType(),
	                     "验证返回EffectiveType与数据库中表Ymt_CouponSetting中iEffectiveType字段相同");
	             }
	             else{
	             	   Logger.verifyEquals(Integer.parseInt(item.get("iEffectiveType").toString()),
	                    		batchInfo.getEffectiveType(),
	                            "验证返回EffectiveType与数据库中表Ymt_CouponSetting中iEffectiveType字段相同");
	             }
	             
	             if(item.get("iEffectiveType")==null)
	             {
	             	 Logger.verifyEquals(0,
	                  		batchInfo.getEffectiveValidType(),
	                          "验证返回EffectiveValidType与数据库中表Ymt_CouponSetting中iEffectiveValidType字段相同");
	                  }
	             else
	             {
	             	 Logger.verifyEquals(Integer.parseInt(item.get("iEffectiveValidType").toString()),
	                  		batchInfo.getEffectiveValidType(),
	                          "验证返回EffectiveValidType与数据库中表Ymt_CouponSetting中iEffectiveValidType字段相同");
	             
	             }

	             Logger.verifyEquals(item.get("dValidStart").toString().subSequence(0, 19),
	             		batchInfo.getEffectiveStartTime().replace("T", " "),
	                     "验证返回dValidStart与数据库中表Ymt_CouponSetting中dValidStart字段相同");

	             Logger.verifyEquals(item.get("dValidEnd").toString().subSequence(0, 19),
	             		batchInfo.getEffectiveEndTime().replace("T", " "),
	                     "验证返回dValidEnd与数据库中表Ymt_CouponSetting中dValidEnd字段相同");
	             
	             if(item.get("iEffectiveDays")==null)
	             {
	             	Logger.verifyEquals(0,
	             		batchInfo.getEffectiveDays(),
	                     "验证返回iEffectiveDays与数据库中表Ymt_CouponSetting中iEffectiveDays字段相同");
	             }
	             else {
	             	Logger.verifyEquals(Integer.parseInt(item.get("iEffectiveDays").toString()),
	                 		batchInfo.getEffectiveDays(),
	                         "验证返回iEffectiveDays与数据库中表Ymt_CouponSetting中iEffectiveDays字段相同");     
	     		}
	             
	           
	             Logger.verifyEquals(Integer.parseInt(item.get("iUserType").toString()),
	             		batchInfo.getApplyUserType(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中iUserType字段相同");
	             
	             if(item.get("sSellerIds")==null)
	             {
	             	Logger.verifyEquals(null,
	             		batchInfo.getApplySellerIds(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中sSellerIds字段相同");
	             }
	             else {
	             	Logger.verifyEquals(item.get("sSellerIds").toString(),
	                 		batchInfo.getApplySellerIds(),
	                         "验证返回BatchCode与数据库中表Ymt_CouponScenario中sSellerIds字段相同");
	     		}
	             
	             if(item.get("sProductCategories")==null)
	             {
	             	Logger.verifyEquals(null,
	             		batchInfo.getApplyProductCategories(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中sProductCategories字段相同");
	             }
	             else {
	             	Logger.verifyEquals(item.get("sProductCategories").toString(),
	                 		batchInfo.getApplyProductCategories(),
	                         "验证返回BatchCode与数据库中表Ymt_CouponScenario中sProductCategories字段相同");
	     		}
	             
	             if(item.get("sSpecificProducts")==null)
	             {
	             	Logger.verifyEquals(null,
	             		batchInfo.getApplyProducts(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中sSpecificProducts字段相同");
	             }
	             else {
	             	Logger.verifyEquals(item.get("sSpecificProducts").toString(),
	                 		batchInfo.getApplyProducts(),
	                         "验证返回BatchCode与数据库中表Ymt_CouponScenario中sSpecificProducts字段相同");
	     		}
	             
	             if(item.get("sProductBrands")==null)
	             {
	             	Logger.verifyEquals(null,
	             		batchInfo.getApplyProductBrands(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中sProductBrands字段相同");
	             }
	             else {
	             	 Logger.verifyEquals(item.get("sProductBrands").toString(),
	                  		batchInfo.getApplyProductBrands(),
	                          "验证返回BatchCode与数据库中表Ymt_CouponScenario中sProductBrands字段相同");
	               
	     		}
	             
	             if(item.get("sActivityIds")==null)
	             {
	             	Logger.verifyEquals(null,
	             		batchInfo.getApplyActivityIds(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中sActivityIds字段相同");
	             }
	             else {
	             	  Logger.verifyEquals(item.get("sActivityIds").toString(),
	                   		batchInfo.getApplyActivityIds(),
	                           "验证返回BatchCode与数据库中表Ymt_CouponScenario中sActivityIds字段相同");        
	     		}
	             
	             if(item.get("sUsePlatforms")==null)
	             {
	             	Logger.verifyEquals(null,
	             		batchInfo.getApplyPlatforms(),
	                     "验证返回BatchCode与数据库中表Ymt_CouponScenario中sUsePlatforms字段相同");
	             }
	             else {
	             	Logger.verifyEquals(item.get("sUsePlatforms").toString(),
	                 		batchInfo.getApplyPlatforms(),
	                         "验证返回BatchCode与数据库中表Ymt_CouponScenario中sUsePlatforms字段相同");
	     		}

//	             Logger.verifyEquals(2,batchInfo.getCouponTotal(),"验证返回CouponTotal");
//	             Logger.verifyEquals(1,batchInfo.getReceivedQuantity(),"验证返回ReceivedQuantity");   
	        }
	}
}